package com.woniuxy.threeproject.end_water_project_user.service.impl;

import com.woniuxy.threeproject.end_water_project_user.domain.Watermeter;
import com.woniuxy.threeproject.end_water_project_user.dao.WatermeterMapper;
import com.woniuxy.threeproject.end_water_project_user.exception.EndWaterRuntimeException;
import com.woniuxy.threeproject.end_water_project_user.service.IWatermeterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 水表、管道表 服务实现类
 * </p>
 *
 * @author Lucas
 * @since 2021-08-25
 */
@Service
@Slf4j
public class WatermeterServiceImpl extends ServiceImpl<WatermeterMapper, Watermeter> implements IWatermeterService {
    @Resource
    public WatermeterMapper watermeterMapper;
    @Override
    public Watermeter addWaterMeter(Watermeter wm) {
        int i = watermeterMapper.insert(wm);
        if(i>0){
            return wm;
        }else{
            throw new EndWaterRuntimeException("水表加入数据库失败！");
        }

    }
}
